# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=perl-pkgconfig-libpkgconf
pkgver=0.11
pkgrel=6
pkgdesc="Perl bindings for libpkgconf"
arch=('loong64' 'x86_64')
license=('PerlArtistic')
url="https://metacpan.org/release/PkgConfig-LibPkgConf"
depends=('perl' 'pkgconf')
options=('!emptydirs')
source=("https://cpan.metacpan.org/authors/id/P/PL/PLICEASE/PkgConfig-LibPkgConf-$pkgver.tar.gz"
        '17.patch' 'tests.diff')
sha512sums=('d9205b364c03dd9ab15128f65e4fbf79c81e3dbd8112d2d94c886e521aa8691907d490698c75c43cb2167ee0d96cf76c36c9930f032f65c5785257b658ca55d4'
            '62383ed625ddc81be5ff5862fad5157d13641e7b55714ea54c9aefbc44d438a94d390c7c7cacf61064244b2846d0aae165a717bc26c4d1a1b725790103fb56bb'
            '1369035dd2cd436a75f90da53da8f33dbe1d6f8877d785c9c7807615ab9d93e0d34608e21a04754556277aea956d160313eea9350001a350a282f3b098d56e0d')

prepare() {
  cd PkgConfig-LibPkgConf-$pkgver

  # Patch for compat with pkgconf 2.0
  # https://github.com/PerlAlien/PkgConfig-LibPkgConf/pull/17
  patch -Np1 -i ../17.patch

  # Further changes to get tests to pass
  patch -Np1 -i ../tests.diff
}

build() {
  cd PkgConfig-LibPkgConf-$pkgver
  perl Makefile.PL INSTALLDIRS=vendor
  make
}

check() {
  cd PkgConfig-LibPkgConf-$pkgver
  make test
}

package() {
  cd PkgConfig-LibPkgConf-$pkgver
  make DESTDIR="$pkgdir" install
}
